import Vue from 'vue'
import App from './App.vue'
import router from './router'
import ViewUI from 'view-design';
import 'view-design/dist/styles/iview.css';
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import request from './api/request'
import api from './api/index'
import VueI18n from 'vue-i18n'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import enLocale from 'element-ui/lib/locale/lang/en'

Vue.use(VueI18n) ;

const i18n = new VueI18n({
  locale: 'en',    // 语言标识, 通过切换locale的值来实现语言切换,this.$i18n.locale
  messages: {
    'zh': {...require('./common/lang/zh'),...zhLocale},   // 中文语言包
    'en': {...require('./common/lang/en'),...enLocale},   // 英文语言包
    'es': require('./common/lang/sp')    // 墨西哥语言包
  }
})


Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

Vue.use(ViewUI);
Vue.config.productionTip = false
// 在原型上扩展,这样不用在每个页面都导入request
Vue.prototype.request = request;
Vue.prototype.$api = api

new Vue({
  router,
  i18n,
  render: h => h(App)
}).$mount('#app')
